home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Bus / C / Commander Demo / Commander Demo.rsrc / TEXT_5014_Append document.txt < prev    next >
Encoding:
Text File  |  1993-09-07  |  2.3 KB  |  44 lines

  1. Append¬†document (document; {type})  -> Document Ref
  2.                                                                                     Pg 26-3
  3.  
  4. document           String    Name of file to append to
  5. type                  String    Type of files to display in Open File dialog
  6. Document ref     Time      Reference variable for the document.
  7.  
  8.  
  9. Append document opens document, an existing Macintosh document, for writing. Data written to the document is appended to the end of the document .
  10.  
  11. If document is an empty string (""), a Macintosh Open File dialog box is presented, and the user may specify the document name.
  12.  
  13.  
  14. If you use an empty string for document (that is, if the open-file dialog box is presented to the user), you may specify the document type with type, a 4-character string. The Open File dialog box then displays only files of that type. The most common document type is TEXT. If you do not specify type, documents of all types can be opened.
  15.  
  16. If the user opens a document, the OK system variable is set to 1 and the Document system variable is set to the name of the opened document. Otherwise, the OK system variable is set to 0. If the document is not opened Append document returns a null document reference.
  17.  
  18.  
  19. The following example opens an existing document called Note, writes the string "Good-bye" into it, and closes the document. If the document already contained the string "Hello", the string would be overwritten:
  20.  
  21. vDoc := Open document ("Note")      ` Open a document called Note
  22. If (OK=1)
  23.    SEND PACKET (vDoc; "Good-bye") ` Write 1 word to the document
  24.    CLOSE DOCUMENT (vDoc)              ` Close the document
  25. End if
  26.  
  27.  
  28. If the Note document on disk is opened by a word processor, the document will now contain the string "Good-bye."
  29.  
  30.  
  31.  
  32. The following example opens an existing document called Note, appends the string "and so long" and a carriage return onto the end of the document, and closes the document. If the document already contained the string "Good-bye", the document would now contain the string "Good-bye and so long", followed by a carriage return:
  33.  
  34. Doc := Append document ("Note")      `  Create Note document
  35. SEND PACKET (Doc; " and so long" + Char (13)) ` Append a string
  36. CLOSE DOCUMENT (Doc)                     `  Close the document
  37.  
  38.  
  39.  
  40. See also:   ¬†Char, Close¬†Document, Open¬†Document, 
  41.                  SEND¬†PACKET
  42.  
  43.  
  44.